<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>
<script type="text/javascript">
	UE.getEditor('myEditor', {
		theme:"default", //皮肤
		lang:"zh-cn", //语言
		initialFrameWidth:800,  //初始化编辑器宽度,默认800
		initialFrameHeight:320
	});
	$("select[name='type']").change(function(){
				var mark = $("select[name='type']").val();
				if(mark==1){
					var type='exchange';
					$('.gift').show();
					$('.normal').hide();
				}else if(mark==2){
					var type='normal';
					$('.gift').hide();
					$('.normal').show();
				}
				else{
					var type="all";
				}
					
				// 拼接AJAX请求
				$.ajax({
					url		: "{:url('Cate/getParentByAjax')}", 
					type	: "post", 
					dataType: "json", 
					data	: {'mark':type, 'Ajax': 1}, 
					success : function(result){
						$("select[name='cate_p_id'] > option").remove();
						$("select[name='cate'] > option").remove();
						var html = "";
						$.each(result, function(i, n){
							html += "<option value='" + n.id + "'>" + n.cate_name + "</option>";
						});
						$("select[name='cate_p_id']").html(html);
					},
					error	: function(){
						alert("服务器内部错误，请联系系统管理员");
					}
				});
			});
	/*$(document).ready(function(e) {
		// 商品分类变更查询
		$("select[name='cate_p_id']").change(function(){
			var selectVal = $(this).val();
			$(this).next().hide().find("option").not(":first").remove();
			if(selectVal != ''){
				$.ajax({
					url		: "{:url('Cate/getCateAjax')}", 
					type	: "post", 
					dataType: "json", 
					data	: {'id': selectVal, 'Ajax': 1}, 
					success : function(result){
						var html = "";
						$.each(result, function(i, n){
							html += "<option value='" + n.cate_name + '.' + n.id + "'>" + n.cate_name + "</option>";
						});
						$("select[name='cate_p_id']").next().show().append(html);
					},
					error	: function(){
						alert("服务器内部错误，请联系系统管理员");
					}
				});
			}
		});
	});
	*/
	// 设为默认图片
	function setDefault(url){
		$("#photos_url").val(url);
		$("#photos_url_preview").attr("src", url);
	}
</script>
<script type="text/html" id="photos-item-wrapper">
	<li id="savedimage{id}">
		<input id="photo_{id}" type="hidden" name="album_url[]" value="{filepath}"> 
		<input id="photo_{id}_name" type="text" name="album_name[]" value="{name}" style="width: 160px;" title="图片名称">
		<img id="photo_{id}_preview" src="{url}" style="height:36px;width: 36px;" onclick="parent.image_preview_dialog(this.src);">
		<a href="javascript:upload_one_image('图片上传','#photo_{id}');">替换</a>
		|
		<a href="javascript:$('#savedimage{id}').remove();">移除</a>
	</li>
</script>